package com.qujia.customer.enums;

import java.util.HashMap;

public enum ElectricCardPayTypeEnum {
    WX("wx","微信"),
    IMP("imp","导入"),

    ;

    private String key;
    private String name;

    ElectricCardPayTypeEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public String getKey() {
        return key;
    }

    public String getName() {
        return name;
    }

    private static HashMap<String, ElectricCardPayTypeEnum> keyMap;

    public static ElectricCardPayTypeEnum getByKey(String key){
        if (keyMap == null) {
            HashMap<String, ElectricCardPayTypeEnum> map = new HashMap<>();
            for (ElectricCardPayTypeEnum value : ElectricCardPayTypeEnum.values()) {
                map.put(value.getKey(),value);
            }
            keyMap = map;
        }
        return keyMap.get(key);
    }
}
